package com.hunau;

import com.hunau.iot.server.nettyserver.HeartBeatServer;
import com.hunau.iot.server.schedule.redisDataSave;
import com.hunau.iot.server.utils.SpringContextUtils;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 启动程序
 * 
 * @author ruoyi
 */
@EnableScheduling
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{

    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        ConfigurableApplicationContext applicationContext = SpringApplication.run(RuoYiApplication.class, args);
        SpringContextUtils.setApplicationCtx(applicationContext);
        //获取BeanFactory
        //DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory) applicationContext.getAutowireCapableBeanFactory();
        //创建bean信息.
        //BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(redisDataSave.class);
        //为成员变量赋值
        //beanDefinitionBuilder.addPropertyValue("name","张三");
        //动态注册bean.
        //defaultListableBeanFactory.registerBeanDefinition("redisDataSave", beanDefinitionBuilder.getBeanDefinition());
//        //获取动态注册的bean.
//        redisDataSave testService =applicationContext.getBean(redisDataSave.class);
//        // 动态删除
//        defaultListableBeanFactory.removeBeanDefinition("redisDataSave");

        System.out.println("(♥◠‿◠)ﾉﾞ  若依启动成功   ლ(´ڡ`ლ)ﾞ  \n" +
                " .-------.       ____     __        \n" +
                " |  _ _   \\      \\   \\   /  /    \n" +
                " | ( ' )  |       \\  _. /  '       \n" +
                " |(_ o _) /        _( )_ .'         \n" +
                " | (_,_).' __  ___(_ o _)'          \n" +
                " |  |\\ \\  |  ||   |(_,_)'         \n" +
                " |  | \\ `'   /|   `-'  /           \n" +
                " |  |  \\    /  \\      /           \n" +
                " ''-'   `'-'    `-..-'              ");
    }
}